<?php
// +----------------------------------------------------------------------
// | ZGUAN [ 致力于帮助更多的中小企业物联网转型 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017~2024 https://www.zguan.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ZGUAN 并不是自由软件，未经许可不能去掉ZGUAN 相关版权
// +----------------------------------------------------------------------
// | Author: ZGUAN Team <admin@zguan.cn>  0769-82282996  15899929162
// +----------------------------------------------------------------------
namespace app\common\dao\users;

use app\common\dao\BaseDao;
use app\common\model\users\UsersModel;

class UsersDao extends BaseDao
{

    /**
     * @return UsersModel
     */
    protected function getModel(): string
    {
        return UsersModel::class;
    }


    /**
     * 根据账号查询用户信息
     * @param $account
     * @return array|mixed|\think\db\BaseQuery|\think\Model|null
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     *
     * @author Amos
     * 2024-01-07 09:16
     */
    public function getInfoByAccount($account)
    {
        return ($this->getModel())::getDB()->where('account', $account)->find();
    }

    /**
     * 根据手机号查询用户信息
     * @param string $mobile
     * @return array|mixed|\think\db\BaseQuery|\think\Model|null
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     *
     * @author Amos
     * 2024-05-08 21:28
     */
    public function getInfoByMobile(string $mobile)
    {
        return ($this->getModel())::getDB()->where('mobile', $mobile)->find();
    }

}
